package org.linlinjava.litemall.admin.controller;

import org.linlinjava.litemall.admin.beans.annotation.LogAnno;
import org.linlinjava.litemall.admin.beans.dto.GoodsReviewDto;
import org.linlinjava.litemall.admin.service.GoodsReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 管理商品评论控制器
 *
 * @author yliyun
 * @description：商品审批controller
 * @date 2022/09/14
 */
@RestController
@RequestMapping("/admin/goods")
public class AdminGoodsReviewController {

    /**
     * 商品评论服务
     */
    @Autowired
    private GoodsReviewService goodsReviewService;

    /**
     * 创建
     * 审核商品通过
     *
     * @param goodsReviewDto 商品评论dto
     * @return {@link Object}
     */
    @PostMapping("/approve")
    @LogAnno
    public Object create(@RequestBody GoodsReviewDto goodsReviewDto) {
        return goodsReviewService.approve(goodsReviewDto);
    }

    /**
     * 细节
     * 审核商品不通过
     *
     * @param goodsReviewDto 商品评论dto
     * @return {@link Object}
     */
    @PostMapping("/reject")
    @LogAnno
    public Object detail(@RequestBody GoodsReviewDto goodsReviewDto) {
        return goodsReviewService.reject(goodsReviewDto);
    }
}
